<!DOCTYPE html>
<html>

<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>智能还款</title>
	<link rel="stylesheet" href="css/amazeui.min.css" />
	<link rel="stylesheet" href="css/app.css" />
	<link rel="stylesheet" href="css/swiper-3.3.1.min.css" />
	<script src="assets/js/jquery.min.js" type="text/javascript"></script>
	<script src="js/amazeui.min.js" type="text/javascript"></script>
	<script src="js/swiper-3.3.1.min.js"></script>

	<style>
		body {
			max-width: 640px;
			margin: 0 auto;
			font-size: 10px;
			background: #F2F3F8;
		}

		* {
			box-sizing: border-box;
		}

		[class*=am-u-] {
			padding: 0;
		}
	</style>
</head>

<body style="background: url(img/bgg.png) center center no-repeat;">
	<!--头部-->
	<header class="am-u">
		<div class="am-u-sm-12 head_nav" style="margin:0;">
			<div class="am-u-sm-2 am-vertical-align" style="text-align: center;">
				<a href="reimbursement.html">
					<img src="img/return@2x.png" class="am-vertical-align-middle" alt="" />
				</a>
			</div>
			<div class="am-u-sm-8 head_text">
				智能还款
			</div>
			<div class="am-u-sm-2">

			</div>
		</div>
	</header>
	<div style="margin-bottom: 180px;">
		<div style="text-align: center;font-size: 18px;font-weight: bold;color:#fff;padding: 60px 0 0px 0;" class="tit">
			开通会员
		</div>
		<div style="padding:10px 20px 10px 20px;">
			<div class="square" style="border: 2px solid #41A0F0;">
				<p style="font-size: 16px;">{$CFG.WEB_NAME}信用卡管家</p>
				<div>

				</div>


			</div>
		</div>
		<div style="text-align: center;margin-top: 3%;margin-bottom: 8%;">
			<span style="border:2px solid #41A0F0;font-size: 15px;color: #41A0F0;padding: 10px 30px 10px 30px;">
				填写激活码
			</span>
		</div>
		<div class="am-u" style="margin-top: 3%;padding: 0 20px 0 20px;margin-bottom: 30%;">
			<div class="am-u-sm-12" style="background: #fff;font-size: 15px;color: #333;padding: 10px 30px 6px 30px;border-radius: 5px;">
				<span class="am-u-sm-5" style="font-weight: bold;">
					输入激活码:
				</span>
				<div class="am-u-sm-7">
					<input id="code" type="text" placeholder="请输入激活码" style="width: 100%;border: none;padding-bottom: 5px;border: none;" />
				</div>
			</div>
		</div>
		<div style="text-align: center;">
			<button type="button" onclick="javascript:upgrade();" class="am-btn" style="color:#fff;background: #0165C7;font-weight: bold;padding: 10px 50px 10px 50px;    border-radius: 5px;">立即升级</button>
		</div>
	</div>
	<script>
		$(function () {
			var token = sessionStorage.getItem("token");
			//激活说明
			$.ajax({
				type: "post",
				url: "http://www.rice.com/app/api/h5_access",
				data: {
					method: "InvitationCode|get_notice",
					token: token
				},
				dataType: "json",
				success: function (result) {
					if (result.status == "1") {
						var data = result.data;
						$(".tit").html(data.article_title);
						data.article_content = data.article_content.replace(/&lt;/g, "<").replace(/&gt;/g, ">");
						$(".square").html(data.article_content);
					} else if (result.status == "2") {
						alert(result.message);
						location.href = "login.html";
					} else {
						alert(result.message);
						return false;
					}
				}
			})





		})
		var token = sessionStorage.getItem("token");
		//激活码
		function upgrade() {
			var code = $("#code").val();
			if (code != "") {
				$.ajax({
					type: 'POST',
					url: "http://www.rice.com/app/api/h5_access",
					contentType: "application/x-www-form-urlencoded; charset=utf-8",
					data: {
						method: "InvitationCode|activation",
						token: token,
						code: code
					},
					datatype: "JSON",
					success: function (data) {
						var data1 = JSON.parse(data);
						console.log(data);
						if (data1.status == 1) {
							alert(data1.msg);
							window.location.href = "reimbursement1.html";
						} else if (data1.status == 0) {
							alert("激活码不存在或激活码已经使用或激活码已经过期！！");
						}
					}
				});
			} else {
				alert("激活码不能为空！");
				return false;
			}
		}
	</script>
</body>

</html>